import { loginHttp, tenantHttp } from '/@/utils/http/axios';

enum Api {
  SEND_VERIFICATION_CODE = '/user/sendVerificationCode',
  SEND_LOGIN_VERIFICATION_CODE = '/v1/saaslanding/sendLoginVerificationCode',
  UPDATE_INFO = '/user/updatePersonInfo',
}

interface InfoParams {
  userName: string;
  name: string;
  phoneNumber: string;
  mail: string;
  oldPassword: string;
  newPassword: string;
  confirmPassword: string;
  verificationCode: string;
}

export const sendLoginVerificationCode = (params: { userName: string; typeEnum: string }) => {
  return loginHttp.post({ url: Api.SEND_LOGIN_VERIFICATION_CODE, params });
};

export const sendVerificationCode = (params: { userId: string; pageType: string; type: string }) => {
  return tenantHttp.get({ url: Api.SEND_VERIFICATION_CODE, params });
};

export const updateInfo = (params: InfoParams) => {
  return tenantHttp.post({ url: Api.UPDATE_INFO, params });
};
